//
//  UIImage+ImageWithScale.m
//  图片选择器
//
//  Created by zxy on 2019/1/18.
//  Copyright © 2019 zxy. All rights reserved.
//

#import "UIImage+ImageWithScale.h"

@implementation UIImage (ImageWithScale)
-(UIImage *)imageScaleWidth:(CGFloat)scaleWidth{
    CGFloat height = scaleWidth *self.size.height / self.size.width;
    UIGraphicsBeginImageContext(CGSizeMake(scaleWidth, height));
    [self drawInRect:CGRectMake(0, 0, scaleWidth, height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
@end
